@page "/cart"

<MudToolBar DisableGutters="true">
    <MudText Typo="Typo.h4">Shopping Cart</MudText>
    <MudSpacer />
    <MudButton Variant="Variant.Outlined" StartIcon=@Icons.Material.Filled.RemoveShoppingCart
        Disabled=@(_cartItems?.Any() is false) Size=@Size.Large
        Color="Color.Secondary" OnClick=@EmptyCartAsync>
        Empty Cart
    </MudButton>
</MudToolBar>

<MudGrid>
    <MudItem xs="12" md="8">
        <MudStack Spacing="8">
            @foreach (var item in _cartItems ?? new HashSet<CartItem>())
            {
                <ShoppingCartItem CartItem=@item
                    OnRemoved=@OnItemRemovedAsync
                    OnUpdated=@OnItemUpdatedAsync />
            }
            <MudDivider/>
        </MudStack>
    </MudItem>
    <MudItem xs="12" md="4">
        <ShoppingCartSummary Items=_cartItems />
    </MudItem>
</MudGrid>
